package com.xc.jiguang.result;


import com.xc.jiguang.utils.ResultVOUtil;
import com.xc.jiguang.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @program: uushop01
 * @author: Yuhe
 * @create: 2022-10-24 22:24
 * @description: 统一异常处理
 */
@RestControllerAdvice
@Slf4j
public class UnifiedExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public ResultVO handlerExcetion(Exception e){
        e.printStackTrace();
        log.info("服务器内部异常，{}",e.getMessage());
        return ResultVOUtil.fail(e.getMessage());
    }
}
